package com.liuguang.provider.controller;

import com.liuguang.common.pojo.User;
import com.liuguang.common.util.UtilTest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpMethod;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @ClassName: TestController
 * @Description：
 * @Author: wanghr
 * Date: 7:25 PM 2020/8/4
 * Version: 1.0
 */
@Slf4j
@RestController
@RequestMapping("/provider")
public class TestController {

    @RequestMapping("/test1")
    public String test1() {
        log.info("进入生产者方法");
        log.info("生产者调用工具类方法：{}",UtilTest.test1());
        return "生产者方法调用成功";
    }

    @RequestMapping("/test2")
    public String test2(@RequestParam String string) {
        log.info("获取请求传入参数:{}", string);
        return string + "111111111111";
    }

    @RequestMapping("/test3")
    public User test3(@RequestBody User user) {
        log.info("获取参数 :{}", user);
        user.setName("xiao 白");
        return user;
    }
    @RequestMapping("/test4")
    public String test4() {
        log.info( "服务可用");
        return  "服务可用";
    }
}
